<template>
  <div class="detail-main">
    <div class="font12 breadcrumb">
      首页/行业资讯/<span class="grey">资讯详情</span>
    </div>
    <div class="main">
      <div class="title-box">
        <h1 class="font24 text-center">{{ data.title }}</h1>
        <p class="font14 grey9 text-center">发布于：{{ data.time }}</p>
      </div>
      <div class="content" v-html="data.content"></div>
      <div class="shotCut font14">
        <p>
          上一篇：<router-link :to="`/information/detail?id=${links[0].id}`">{{
            links[0].title
          }}</router-link>
        </p>
        <p>
          下一篇：<router-link :to="`/information/detail?id=${links[1].id}`">{{
            links[1].title
          }}</router-link>
        </p>
      </div>
    </div>
  </div>
</template>
<script>
import { getDetailData } from "@/api/information.js";
export default {
  data() {
    return {
      id: null, //当前文章的id
      data: {
        title: "",
        time: "",
        content: "",
      },
      links: [
        {
          id: 4,
          title: "在布里斯班买房多少钱？放假总体呈现上升趋势",
        },
        {
          id: 5,
          title: "休斯顿6月房屋成交额达28亿美金，你还在等什么",
        },
      ],
    };
  },
  created() {
    console.log("sssss");
    let id = this.$route.query.id;
    this.id = id;
    this.getDetail();
  },
  methods: {
    getDetail() {
      var params = {
        newsId: 3586,
        entpId: 170,
      };
      getDetailData(params)
        .then((response) => {
          let res = response.data;
          if (res.code === "0") {
            this.data = Object.assign({}, res.data);
          }
        })
        .catch((error) => {
          this.data = {
            title: "",
            time: "",
            content: "",
          };
          this.$message.error(err.message || "出错了");
        });
    },
  },
};
</script>
<style scoped>
.detail-main {
  background: gold;
  width: 1200px;
  margin: 0 auto;
}
.breadcrumb {
  padding: 20px 0;
}
.detail-main .main {
  width: 100%;
  background: #fff;
  padding: 40px 100px;
  box-sizing: border-box;
}
.title-box {
  border-bottom: 1px solid #eee;
  margin-bottom: 15px;
  color: #333;
}
.title-box h1 {
  font-weight: normal;
}
.text-center {
  text-align: center;
}
.content {
  margin-bottom: 100px;
}
.shotCut a {
  text-decoration: none;
  color: #999;
}
.shotCut a:hover {
  color: #6495ed;
}
</style>
